1. Field of the Invention
The present invention relates generally to the field of graphics processing and more specifically to a system and method for structuring an A-Buffer to support multi-sample anti-aliasing.
2. Description of the Related Art
One task that a graphics processing unit (GPU) may perform when transforming 3-D images into 2-D images is to determine the visible color of each pixel in the image. Each pixel may include multiple samples, wherein each sample corresponds to a different location within the image covered by the pixel. To determine the color at each pixel, each sample intersected by an object may be evaluated to create a portion of the overall color of the pixel that includes a variety of effects, such as transparency and depth of field. For example, suppose each pixel includes four samples, and two objects abut in a particular pixel. One of the samples may reflect the color of the first object, and three of the samples may reflect the color of the second object. The contributions from all four samples may be evaluated when determining the visible color for the pixel using well-known techniques, such as multi-sample anti-aliasing, that improve image quality by, among other things, reducing edge artifacts in images.
Some GPUs increase the efficiency of multi-sample anti-aliasing by using a variety of compression techniques to reduce memory bandwidth and computational work. For example, if all of the samples included in a particular pixel are the same color, then the GPU may determine that the pixel is compressible and may represent all four samples (i.e., the pixel) using the information needed to represent only a single color. Similarly, if all of the pixels included in an image tile of proximally located pixels are compressible, then the GPU may determine that the image tile is compressible and may represent the image tile using a reduced amount of color information. Reducing the data used to represent the pixels and image tiles reduces the memory bandwidth used when accessing the pixels and tiles in memory. Further, the GPU may save computational work by performing blending operations and the like using the compressed pixel representations instead of the sample representations.
In some approaches to determining the visible color of each pixel, the objects in an image may need to be rendered in a specific order to ensure that the visible color of each pixel in the generated image is realistic. However, in other approaches, the sample data representing the intersections of samples by the various objects may be collected, sorted, and reduced to an image that accurately displays advanced effects irrespective of the order in which the objects are rendered. One structure that computing systems may implement in these various approaches is an A-Buffer—a memory structure that maintains sample data associated with each polygon that intersects the pixels of an image frame being rendered.
In one approach to organizing an A-Buffer, the A-Buffer stores a linked list of the sample data. One drawback to this approach is that the A-Buffer structure is not conducive to some of the most frequently used sample data access patterns. For example, when a polygon is rendered, much of the corresponding sample data is located in adjacent pixels at the same per-sample rendering order index (PSROI). As is well known, memory accesses are usually most efficient if they can be grouped such that successive accesses target data that is closely located within the memory—known as memory locality. Thus, an efficient memory structure would enable sample data of this nature, located at the same index, to be simultaneously accessed. However, since each sample in the A-Buffer has a separate linked list, sample data corresponding to adjacent samples at the same PSROI may be far apart in memory, leading to poor memory locality. Consequently, accesses to the A-Buffer may be inefficient. Another drawback is that the sample data corresponding to each sample is stored discretely and, therefore, such an approach does not support the compression techniques that GPUs oftentimes use to reduce memory bandwidth and increase efficiency.
As the foregoing illustrates, what is needed in the art is a more effective technique for creating and accessing an A-Buffer that supports multi-sample anti-aliasing.